package day09;

import java.math.BigDecimal;
import java.util.Scanner;

public class bigDemicalPrc01 {
    public static void main(String[] args) {

        method();
//        method2();
    }

    private static void method2() {
        System.out.println("请输入第一个数:");
        double d1=new Scanner(System.in).nextDouble();
        System.out.println("请输入第二个数:");
        double d2=new Scanner(System.in).nextDouble();
        BigDecimal bd1=new BigDecimal(d1+"");
        BigDecimal bd2=new BigDecimal(d2+"");
        BigDecimal bd3;
        bd3=bd1.multiply(bd2);
        System.out.println(bd3);
        System.out.println("************");
        bd3=bd1.divide(bd2,4,BigDecimal.ROUND_HALF_UP);
        System.out.println(bd3);
        bd3=bd1.divide(bd2,4,BigDecimal.ROUND_HALF_DOWN);
        System.out.println(bd3);
        bd3=bd1.divide(bd2,4,BigDecimal.ROUND_HALF_EVEN);
        System.out.println(bd3);
        bd3=bd1.add(bd2);
        System.out.println(bd3);
        bd3=bd1.subtract(bd2);
        System.out.println(bd3);
    }

    private static void method() {
        System.out.println("请输入第一个数:");
        double d1=new Scanner(System.in).nextDouble();
        System.out.println("请输入第二个数:");
        double d2=new Scanner(System.in).nextDouble();
        BigDecimal bd1=new BigDecimal(d1+"");
        BigDecimal bd2=new BigDecimal(d2+"");
        BigDecimal bd3;
        bd3=bd1.divide(bd2,1,BigDecimal.ROUND_HALF_UP);
        System.out.println(bd3);
        bd3=bd1.divide(bd2,1,BigDecimal.ROUND_HALF_EVEN);
        System.out.println(bd3);
        bd3=bd1.divide(bd2,1,BigDecimal.ROUND_HALF_DOWN);
        System.out.println(bd3);
        bd3=bd1.divide(bd2,1,BigDecimal.ROUND_DOWN);
        System.out.println(bd3);
        bd3=bd1.divide(bd2,1,BigDecimal.ROUND_FLOOR);
        System.out.println(bd3);
    }
}
